home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F19117EA-F7D4-11D1-8500-D25A8F8C626C}#5.0#0"; "JKJoystick_Share.ocx"
- Begin VB.Form Form1
- BackColor = &H80000004&
- Caption = "JK Joystick Control - Demo"
- ClientHeight = 4545
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6210
- ClipControls = 0 'False
- ControlBox = 0 'False
- DrawStyle = 1 'Dash
- LinkTopic = "Form1"
- ScaleHeight = 4545
- ScaleWidth = 6210
- StartUpPosition = 3 'Windows Default
- Begin Joystick.JKJoystick JKJoystick1
- Left = 3000
- Top = 3960
- _ExtentX = 847
- _ExtentY = 847
- End
- Begin VB.OptionButton Option1
- Caption = "3"
- Height = 255
- Index = 3
- Left = 4800
- TabIndex = 21
- Top = 3000
- Width = 1095
- End
- Begin VB.OptionButton Option1
- Caption = "2"
- Height = 255
- Index = 2
- Left = 4800
- TabIndex = 20
- Top = 2760
- Width = 1095
- End
- Begin VB.OptionButton Option1
- Caption = "1"
- Height = 255
- Index = 1
- Left = 4800
- TabIndex = 19
- Top = 2520
- Width = 1095
- End
- Begin VB.OptionButton Option1
- Caption = "0"
- Height = 255
- Index = 0
- Left = 4800
- TabIndex = 18
- Top = 2280
- Value = -1 'True
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "Test Joystick Port #0"
- Height = 375
- Index = 0
- Left = 2880
- TabIndex = 16
- Top = 1920
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "Test Joystick Port #3"
- Height = 375
- Index = 3
- Left = 2880
- TabIndex = 15
- Top = 3360
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "Test Joystick Port #2"
- Height = 375
- Index = 2
- Left = 2880
- TabIndex = 14
- Top = 2880
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "Test Joystick Port #1"
- Height = 375
- Index = 1
- Left = 2880
- TabIndex = 13
- Top = 2400
- Width = 1695
- End
- Begin VB.PictureBox Picture3
- Height = 2175
- Left = 2400
- ScaleHeight = 2115
- ScaleWidth = 195
- TabIndex = 10
- Top = 1920
- Width = 255
- Begin VB.Line Line2
- BorderColor = &H000000FF&
- BorderWidth = 3
- X1 = 0
- X2 = 240
- Y1 = 600
- Y2 = 600
- End
- End
- Begin VB.PictureBox Picture2
- Height = 255
- Left = 120
- ScaleHeight = 195
- ScaleWidth = 2115
- TabIndex = 9
- Top = 4200
- Width = 2175
- Begin VB.Line Line1
- BorderColor = &H000000FF&
- BorderWidth = 3
- X1 = 240
- X2 = 240
- Y1 = 0
- Y2 = 240
- End
- End
- Begin VB.PictureBox Picture1
- Height = 2175
- Left = 120
- ScaleHeight = 2115
- ScaleWidth = 2115
- TabIndex = 8
- Top = 1920
- Width = 2175
- Begin VB.Shape Shape1
- Height = 135
- Left = 720
- Top = 1080
- Width = 135
- End
- End
- Begin VB.Label Label10
- Caption = "Middle"
- Height = 255
- Left = 4560
- TabIndex = 24
- Top = 960
- Width = 1455
- End
- Begin VB.Label Label9
- Caption = "Coolie hat position:"
- Height = 255
- Left = 4560
- TabIndex = 23
- Top = 720
- Width = 1575
- End
- Begin VB.Label Label8
- Caption = $"demo.frx":0000
- Height = 495
- Left = 120
- TabIndex = 22
- Top = 120
- Width = 6015
- End
- Begin VB.Label Label7
- Caption = "Current Port:"
- Height = 255
- Left = 4800
- TabIndex = 17
- Top = 1920
- Width = 975
- End
- Begin VB.Label Label6
- Caption = "(None)"
- Height = 255
- Left = 2880
- TabIndex = 12
- Top = 960
- Width = 2175
- End
- Begin VB.Label Label5
- Caption = "Buttons (last action):"
- Height = 255
- Left = 2880
- TabIndex = 11
- Top = 720
- Width = 2055
- End
- Begin VB.Label throttlest
- Caption = "Label8"
- Height = 255
- Left = 840
- TabIndex = 7
- Top = 1560
- Width = 1575
- End
- Begin VB.Label rudderst
- Caption = "Label7"
- Height = 255
- Left = 840
- TabIndex = 6
- Top = 1320
- Width = 975
- End
- Begin VB.Label yst
- Caption = "Label6"
- Height = 255
- Left = 840
- TabIndex = 5
- Top = 960
- Width = 1095
- End
- Begin VB.Label xst
- Caption = "Label5"
- Height = 255
- Left = 840
- TabIndex = 4
- Top = 720
- Width = 975
- End
- Begin VB.Label Label4
- Caption = "Throttle:"
- Height = 255
- Left = 120
- TabIndex = 3
- Top = 1560
- Width = 615
- End
- Begin VB.Label Label3
- Caption = "Rudder:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 1320
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "Y:"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 960
- Width = 255
- End
- Begin VB.Label Label1
- Caption = "X:"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 720
- Width = 135
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click(Index As Integer)
- If JKJoystick1.TestStick(Index) = True Then
- MsgBox "Joystick on port " & Trim(Str(Index)) + " correctly connected!", , "JKJoystick"
- MsgBox "No Joystick on port " & Trim(Str(Index)) + " or not correctly connected!", , "JKJoystick"
- End If
- End Sub
- Private Sub Form_Load()
- JKJoystick1.TStart
- End Sub
- Private Sub JKJoystick1_ButtonPressed(ID As Integer)
- Label6 = "Button pressed: " & ID
- End Sub
- Private Sub JKJoystick1_ButtonReleased(ID As Integer)
- Label6 = "Button released: " & ID
- End Sub
- Private Sub JKJoystick1_CoolieChanged(NewCoolie As Integer)
- Select Case NewCoolie
- Case 0
- Label10 = "Middle"
- Case 1
- Label10 = "Up"
- Case 2
- Label10 = "Upper-right"
- Case 3
- Label10 = "Right"
- Case 4
- Label10 = "Lower-right"
- Case 5
- Label10 = "Down"
- Case 6
- Label10 = "Lower-left"
- Case 7
- Label10 = "Left"
- Case 8
- Label10 = "Upper-left"
- End Select
- End Sub
- Private Sub JKJoystick1_PosChange(NewX As Long, NewY As Long, NewThrottle As Long, NewRudder As Long)
- xst = NewX
- yst = NewY
- rudderst = NewRudder
- throttlest = NewThrottle
- Dim a
- Dim b
- a = (NewX / 72000) * Picture1.Width
- b = (NewY / 72000) * Picture1.Height
- Shape1.Move a, b
- a = (NewRudder / 69000) * Picture2.Width
- Line1.X1 = a
- Line1.X2 = a
- a = (NewThrottle / 69000) * Picture3.Height + 20
- Line2.Y1 = a
- Line2.Y2 = a
- End Sub
- Private Sub Option1_Click(Index As Integer)
- JKJoystick1.JoystickID = Index
- End Sub
-